home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak Vol A-4
/
(Vol A-4) Vol. A4.iso
/
Games
/
the-kitchen-of-doom.swf
/
scripts
/
frame_1
/
DoAction.as
Wrap
Text File
|
2008-03-14
|
4KB
|
133 lines
stop();
StringTable = function(xmlFile)
{
this.table = new Array();
this.loadData(xmlFile);
};
StringTable.prototype.loadData = function(source)
{
var _loc3_ = this;
_loc3_.xmlFile = new XML();
_loc3_.xmlFile.load(source);
_loc3_.xmlFile.ignoreWhite = true;
_loc3_.xmlFile.notify = _loc3_;
_loc3_.xmlFile.onLoad = function()
{
var stringID = "";
var _loc3_ = "";
var _loc2_ = this.firstChild.childNodes;
var _loc1_ = 0;
while(_loc1_ < _loc2_.length)
{
if(_loc2_[_loc1_].nodeName === "string")
{
stringID = _loc2_[_loc1_].attributes.id;
_loc3_ = _loc2_[_loc1_].firstChild.nodeValue;
this.notify.table[stringID] = _loc3_;
}
_loc1_ = _loc1_ + 1;
}
this.notify.loaded = true;
if(this.notify.onLoad != null)
{
this.notify.onLoad();
}
delete this;
};
};
StringTable.prototype["get"] = function(stringID)
{
return this.table[stringID];
};
StringTable.prototype.populate = function()
{
this.populateFieldsIn(_root);
};
StringTable.prototype.populateFieldsIn = function(target)
{
var _loc1_ = target;
var _loc3_ = this;
for(obj in _loc1_)
{
if(_loc1_[obj] instanceof TextField)
{
if(_loc1_[obj].text.substr(0,4) == "IDS_")
{
var _loc2_ = _loc3_["get"](_loc1_[obj].text);
if(_loc2_ != null)
{
_loc1_[obj].text = _loc2_;
}
}
}
else if(_loc1_[obj] instanceof MovieClip)
{
_loc3_.populateFieldsIn(_loc1_[obj]);
}
else if(_loc1_[obj] instanceof Button)
{
_loc3_.populateFieldsIn(_loc1_[obj]);
}
}
};
StringTable.prototype.getBytesLoaded = function()
{
return this.xmlFile.getBytesLoaded();
};
StringTable.prototype.getBytesTotal = function()
{
return this.xmlFile.getBytesTotal();
};
StringTable.prototype.getPercentLoaded = function()
{
var _loc1_ = this;
if(_loc1_.xmlFile.getBytesTotal() <= 0)
{
return 0;
}
var _loc2_ = Math.round(_loc1_.xmlFile.getBytesTotal() / _loc1_.xmlFile.getBytesTotal() * 100);
return _loc2_;
};
StringTable.prototype.dump = function()
{
var _loc1_ = this;
trace("===============================");
trace(" ");
trace("Dumping the String Table:");
trace(" ");
trace("String ID Value");
trace("--------- -----");
for(var _loc2_ in _loc1_.table)
{
trace(_loc2_ + " " + _loc1_.table[_loc2_]);
}
trace(" ");
trace("String Table dump done.");
trace("===============================");
trace(" ");
};
Stage.scaleMode = "noScale";
Stage.showMenu = false;
_quality = "HIGH";
sysInfoSent = false;
fpsInfoSent = false;
_global.masterVolume = new Sound();
restoreVolume = _global.masterVolume.getVolume();
StrTable = new StringTable("kodstrings.xml");
onEnterFrame = function()
{
var _loc2_ = (getBytesLoaded() + StrTable.getBytesLoaded()) / (getBytesTotal() + StrTable.getBytesTotal());
var _loc1_ = int(_loc2_ * 100);
if(isNaN(_loc1_))
{
_loc1_ = 0;
}
BarInst._xscale = _loc1_;
if(getBytesTotal() > 0 && getBytesLoaded() >= getBytesTotal() && StrTable.loaded)
{
delete onEnterFrame;
gotoAndStop("Title Screen");
play();
}
};